#include <SGE.h>
#include "PlayState.h"
#include "FrontendState.h"

using namespace SGE;



GameState* currentState = nullptr;
NextState nextState = Gameplay;



void SGE_Initialize()
{
	

}

void SGE_Terminate()
{
	
}

bool SGE_Update(float deltaTime)
{
	if(nextState != None)		//unload current state
	{
		if(currentState !=nullptr)						// first new bos unload
		{
			currentState->Unload();
			delete currentState;
		}
	switch(nextState)			//change state
	{
	
	case Frontend:
		currentState = new FrontendState();
	case Gameplay:
		currentState = new PlayState();
	}
	nextState = currentState->Update(deltaTime);
	if(nextState == Quit)
	{
		currentState->Unload();
		delete currentState;
		return true;
	}
	return false;
}
}

void SGE_Render()
{
	currentState->Render();
}